﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace QD.Push.V3
{
    public class PushOptions
    {

        public PushOptions(string apikey, string msg)
        {
            this.apikey = apikey;
            this.msg_type = 1;      //通知
            this.msg = msg;
            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0);
            this.timestamp = (uint)ts.TotalSeconds;
        }

        /// <summary>
        /// 单播
        /// </summary>
        /// <param name="apikey"></param>
        /// <param name="channel_id"></param>
        /// <param name="device_type"></param>
        /// <param name="messages"></param>
        /// <param name="timestamp"></param>
        public PushOptions(string apikey, string channel_id, string msg, mDeviceType device_type)
        {
            this.apikey = apikey;
            this.channel_id = channel_id;
            this.msg_type = 1;      //通知
            this.msg = msg;
            this.device_type = (uint)device_type;
            TimeSpan ts = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
            this.timestamp = (uint)ts.TotalSeconds;
        }
        /// <summary>
        /// 批量单播
        /// </summary>
        /// <param name="apikey"></param>
        /// <param name="device_type">3.0版 目前只支持安卓</param>
        /// <param name="channel_ids"></param>
        /// <param name="msg"></param>
        public PushOptions(string apikey, mDeviceType device_type, string channel_ids, string msg)
        {
            this.apikey = apikey;
            this.channel_ids = channel_ids;
            this.msg_type = 1;      //通知
            this.msg = msg;
            this.device_type = (uint)device_type;
            TimeSpan ts = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
            this.timestamp = (uint)ts.TotalSeconds;
        }


        /// <summary>
        /// 访问令牌，明文AK，可从此值获得App的信息，配合sign中的sk做合法性身份认证。
        /// </summary>
        public string apikey { get; set; }

        /// <summary>
        /// 单个手机标识
        /// </summary>
        public string channel_id { get; set; }

        /// <summary>
        /// 一组手机标识(批量单薄用到)
        /// </summary>
        public string channel_ids { get; set; }

        /// <summary>
        /// 消息内容，单个消息为单独字符串，多个消息用json数组表示。description：通知文本内容，不能为空，否则Android端上不展示。 
        /// </summary>
        public string msg { get; set; }

        /// <summary>
        /// 用户发起请求时的unix时间戳。本次请求签名的有效时间为该时间戳+10分钟。
        /// </summary>
        public uint timestamp { get; set; }

        /// <summary>
        /// 调用参数签名值，与apikey成对出现。
        /// </summary>
        public string sign { get; set; }
        /// <summary>
        /// 用户指定本次请求签名的失效时间。格式为unix时间戳形式。
        /// </summary>
        public uint? expires { get; set; }
        /// <summary>
        ///可空： 1：开发状态 2：生产状态
        /// </summary>
        public uint? deploy_status { get; set; }
        /// <summary>
        ///  消息类型 0 消息 1 通知 默认值为0。
        /// </summary>
        public uint? msg_type { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public uint? device_type { get; set; }

    }
}